<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
    public function __construct(){
		parent::__construct();
		header("Content-Type:text/html; charset=utf-8");
    }
    public function Index(){
	  if($this->_session('user_login') == '')
	    	redirect('/admin/Index/login',1,'没有登录,请登录...');
      $this->display();
    }
    public function login(){
    	if($this->_post('post') == 'login'){
	    	if (!to_ken($this->_post(C('TOKEN_NAME'))))
	    		redirect('/admin/Index/login',5,'非法操作,跳转中...');	    
	    	$_SESSION['user_login'] = $this->_post('usname');
	    	redirect('/admin/',1,$this->_post('usname').'登陆成功...');
	    }
    	
    	$this->display();
    }
    //退出
    public function quit(){
        unset($_SESSION['user_login']);
		redirect('/admin/Index/login',1,'退出成功...');
    }
}